feat: add keyboard shortcuts and hints (#1138, #1222)#1232
Conversation
🚀 Preview Deployment
Preview will be automatically removed when this PR is closed. |
There was a problem hiding this comment.
1 issue found across 10 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/frontend/src/hooks/use-keyboard-shortcuts.ts">
<violation number="1" location="apps/frontend/src/hooks/use-keyboard-shortcuts.ts:21">
P2: Platform-specific shortcuts also fire with the other platform's modifier: e.g. `Ctrl+B` toggles the sidebar on macOS despite the advertised `⌘B`. Make matching choose `metaKey` on macOS and `ctrlKey` elsewhere, matching displayed shortcuts.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 6 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/frontend/src/lib/stories-cache.ts">
<violation number="1" location="apps/frontend/src/lib/stories-cache.ts:12">
P2: Opening Stories through this helper can retain a stale archived shared-stories list for up to the query stale time. Include `story.listSharedArchived` with the other story cache keys.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| [message.parts, toolCallDensity], | ||
| ); | ||
| const hasContent = useMemo(() => checkAssistantMessageHasContent(message), [message]); | ||
| const isCancelling = useIsCancellingMessage(message.id); |
There was a problem hiding this comment.
This is the key change we need
A way to know when user is cancelling so that we skip the "No Response" printing
| }; | ||
| restoreImages(); | ||
| }, [allowQueueing, chatInputRestore]); // eslint-disable-line react-hooks/exhaustive-deps | ||
|
|
There was a problem hiding this comment.
This is so that if user cancels a prompt he still keeps his images/files, and text prompt as it was
| cancellingMessageIdStore.setCancelling(undefined); | ||
| } | ||
| }, [chatId, messages, agentInstance, cancelAgentMutation, setMessages, navigate, queryClient]); | ||
|
|
|
LGTM except the changes in the following files:
I think we needed those to create the ability to totally cancel the prompt and all that comes with it ("No Response" and the like, copy buttons) easily |
Summary
lib/keyboard-shortcuts.ts),useKeyboardShortcutshook (ignores keystrokes while typing in inputs/editors), and aplatform.tsutil (⌘ on macOS, Ctrl elsewhere), mounted once in_sidebar-layout.tsx.Mod+Btoggle sidebar,Mod+Kcommand palette,Shift+Mod+Onew chat,Shift+Mod+SStories,Mod+/keyboard-shortcuts dialog.⇧⌘S), a Keyboard shortcuts help dialog, and "Keyboard shortcuts" + "Go to Stories" command-menu entries.⇧⌘Olistener and the duplicate⌘Klistener; de-duplicatednavigator.platformchecks via the shared util.How to test
Just do Command/Ctrl + / to see this

Also check out the keyboard shortcut hint which shows when hovering over the toggle sidebar button
Closes #1138
Closes #1222